const list = [
    { id: 1, name: '李明', age: 25, birthday: '1997-03-15' },
    { id: 2, name: '赵敏', age: 42, birthday: '1980-05-09' },
    { id: 3, name: '周杰', age: 58, birthday: '1964-08-23' },
    { id: 4, name: '刘洋', age: 37, birthday: '1985-11-02' },
    { id: 5, name: '孙悟', age: 68, birthday: '1954-01-14' },
    { id: 6, name: '吴玉', age: 19, birthday: '2003-07-30' },
    { id: 7, name: '朱文', age: 33, birthday: '1989-09-19' },
    { id: 8, name: '王芳', age: 51, birthday: '1971-04-05' },
    { id: 9, name: '刘洋', age: 44, birthday: '1978-06-12' },
    { id: 10, name: '张伟', age: 29, birthday: '1993-12-26' }
]
const ids = [3, 4, 9]



function a(list, ids) {
    const idsMap = {}, res = []
    ids.forEach((item) => {
        idsMap[item] = item
    })

    list.forEach(item => {
        idsMap[item.id] && res.push(item)
    })

    return res
}
a(list, ids)
// 返回
// const res = [
//     { id: 3, name: '周杰', age: 58, birthday: '1964-08-23' },
//     { id: 4, name: '刘洋', age: 37, birthday: '1985-11-02' },
//     { id: 9, name: '刘洋', age: 44, birthday: '1978-06-12' },
// ]